﻿CREATE TABLE [dbo].[tCompanies]
(
	[companyId] INT NOT NULL CONSTRAINT [pk_tCompanies_companyId] PRIMARY KEY IDENTITY(1,1), 
	[globalId] UNIQUEIDENTIFIER NOT NULL CONSTRAINT [df_tCompanies_globalId] DEFAULT NEWID(),
    [name] VARCHAR(250) NOT NULL, 
    [summury] VARCHAR(250) NULL, 
    [logoUrl] VARCHAR(250) NULL,
	[logoBinary] VARBINARY(max) NULL,
	[deltaPunchTime] INT NOT NULL CONSTRAINT [df_tCompanies_deltaPunchTime] DEFAULT 5,
	[registerCode] VARCHAR(10) NOT NULL,
	[createdBy] INT NOT NULL CONSTRAINT[fk_tCompanies_createdBy] FOREIGN KEY(createdBy) REFERENCES dbo.tusers([userId]),
	[isActive] BIT NOT NULL CONSTRAINT [df_tCompanies_iaActive] DEFAULT 1, 
    [isDeleted] BIT NOT NULL CONSTRAINT [df_tCompanies_isDeleted] DEFAULT 0
	--[dateCreated_utc] DATETIMEOFFSET NOT NULL CONSTRAINT [df_tCompanies_dateCreated_utc] DEFAULT GETUTCDATE(), 
 --   [lastUpdated_utc] DATETIMEOFFSET NOT NULL CONSTRAINT [df_tCompanies_lastUpdated_utc] DEFAULT GETUTCDATE(), 
 --   [lastActivityDate_utc] DATETIMEOFFSET NOT NULL CONSTRAINT [df_tCompanies_lastActivityDate_utc] DEFAULT GETUTCDATE(), 
 --   [companyRegistered_ip] VARCHAR(50) NULL, 
	--[registered_MAC_address] VARCHAR(50),
	--[lastActive_MAC_address] VARCHAR(50),
 --   [lastActivity_ip] VARCHAR(50) NULL
)